# config_manager.py
import yaml

class ConfigManager:
    def __init__(self, config_path="configs.yaml"):
        self.config_path = config_path
        self.config = self.load_config()

    def load_config(self):
        # 加载 YAML 配置文件
        with open(self.config_path, "r") as file:
            config = yaml.safe_load(file)
        return config

    def get_common_config(self):
        return self.config.get("common", {})

    def get_device_config(self, device_type):
        return self.config.get(device_type.lower(), {})

    def get_full_config(self, device_type):
        # 合并 common 配置和设备特定配置
        common_config = self.get_common_config()
        device_config = self.get_device_config(device_type)
        full_config = {**common_config, **device_config}
        return full_config
